using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ApplicationBlocks.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataHelper.DAL
{
    public class TK_Country
    {
private static  string m_trConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;

       #region TK_CountrySelectAll
        public static SqlDataReader TK_CountrySelectAll(string strSearch="",int top = 1, int bottom = 20, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "TK_CountrySelectAllRows",strSearch,top,bottom);
            return SqlHelper.ExecuteReader(m_trConnectionString, "TK_CountrySelectAllRows",strSearch,top,bottom);
        }
        #endregion
       #region TK_CountrySelectRow
        public static SqlDataReader TK_CountrySelectRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
                return SqlHelper.ExecuteReader(ConnectionString, "TK_CountrySelectRow", ID);
            return SqlHelper.ExecuteReader(m_trConnectionString, "TK_CountrySelectRow", ID);
        }
        #endregion
       #region TK_CountryInsertRow
        public static void TK_CountryInsertRow(int ID, string Name, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "TK_CountryInsertRow", ID, Name, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "TK_CountryInsertRow", ID, Name, IsDeleted);
        }
        #endregion
       #region TK_CountryUpdateRow
        public static void TK_CountryUpdateRow(int ID, string Name, bool IsDeleted, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "TK_CountryUpdateRow", ID, Name, IsDeleted);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "TK_CountryUpdateRow", ID, Name, IsDeleted);
        }
        #endregion
       #region TK_CountryDeleteRow
        public static void TK_CountryDeleteRow(int ID, SqlTransaction ConnectionString = null)
        {
            if (ConnectionString != null)
            {
                SqlHelper.ExecuteNonQuery(ConnectionString, "TK_CountryDeleteRow", ID);
                return;
            }
            SqlHelper.ExecuteNonQuery(m_trConnectionString, "TK_CountryDeleteRow", ID);
        }
        #endregion

    }
}

